<template>
  <div class="">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/main' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <el-table :data="rightlist" style="width: 100%" stripe border>
        <el-table-column type="expand"></el-table-column>
        <el-table-column type="index"></el-table-column>
        <el-table-column label="角色名称" prop="authName"></el-table-column>
        <el-table-column label="角色描述" prop="path"></el-table-column>
        <el-table-column prop="level" label="权限等级">
        </el-table-column>
        <el-table-column label="权限" width="300px">
          <template slot-scope="scope">
              <el-tag v-if="scope.row.level==0">一级权限</el-tag>  
              <el-tag v-else-if="scope.row.level==1" type="success">二级权限</el-tag>  
              <el-tag v-else type="warning">三级权限</el-tag>  
              <!-- {{scope.row}} -->
          </template>

        </el-table-column>
      </el-table>
    </el-card>

  </div>
</template>

<script>
  export default {
    components: {},
    data() {
      return {
        rightlist: [],
      }
    },
    created() {
      this.getrightsList()
    },
    mounted() {},
    watch: {},
    computed: {},
    methods: {
      getrightsList() {
        this.$axios.get('/rights/list').then(val => {
          if (val.meta.status != 200) {
            return this.$message.error('获取权限失败')
          }
          this.rightlist = val.data
        })
      }
    },
  }
</script>
<style lang="css" scoped>
</style>